﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace comCtrl
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            List<string> names = new List<string>();
            List<string> fullNames = new List<string>();
            Dictionary<string, string> dict = new Dictionary<string, string>();
            FileInfo[] fileInfos = new DirectoryInfo("Skins").GetFiles();
            foreach (FileInfo f in fileInfos)
            {
                names.Add(f.Name);
                fullNames.Add(f.FullName);
                dict.Add(f.Name, f.FullName);
            }

            textBox1.Lines = dict.Keys.ToArray();
            textBox2.Lines = dict.Values.ToArray();

            skinEngine1.SkinFile = fullNames.FirstOrDefault();

            comboBox1.DataSource = fileInfos;
            listBox1.DataSource = fileInfos;
        }

        /// <summary>
        /// 选择皮肤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            FileInfo f = (FileInfo)comboBox1.Items[comboBox1.SelectedIndex];
            skinEngine1.SkinFile = f.FullName;
        }
    }
}
